﻿using System.Xml.Serialization;

namespace ALiOss;
[Serializable()]
[System.ComponentModel.DesignerCategory("code")]
[XmlType(AnonymousType = true)]
//[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
[XmlRoot("ListBucketResult")]
public class FileMetas
{


    [XmlElement("CommonPrefixes")]
    public List<ListBucketResultCommonPrefixes> CommonPrefixes { get; set; } = default!;

    /// <remarks/>
    [Serializable()]
    [System.ComponentModel.DesignerCategory("code")]
    [XmlType(AnonymousType = true)]
    public partial class ListBucketResultCommonPrefixes
    {
        public string Prefix { get; set; } = default!;
    }



    public string Name { get; set; } = default!;

    /// <remarks/>
    public int MaxKeys { get; set; }
    public List<string> Keys
    {
        get
        {
            if (KeyCount == 0)
                return new();
            else
                return Items.Select(ii => ii.Key).ToList();
        }
    }

    [XmlElement("Contents")]
    public List<ListBucketResultContents> Items { get; set; } = new List<ListBucketResultContents>();

    public int KeyCount { get; set; }

    [Serializable()]
    [System.ComponentModel.DesignerCategory("code")]
    [XmlType(AnonymousType = true)]
    public class ListBucketResultContents
    {

        public string Key { get; set; } = default!;
        public DateTime LastModified { get; set; }
        public string ETag { get; set; } = default!;
        public string Type { get; set; } = default!;
        public uint Size { get; set; }
        public string StorageClass { get; set; } = default!;
    }

}
